package com.byd.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;
import com.byd.adapter.VideoAdapter.VideoHolder;
import com.byd.base.BaseAdapter;
import com.byd.base.BaseHolder;
import com.byd.streamer.MediaInfo;
import com.byd.streamer.R;

public class VideoAdapter extends BaseAdapter<MediaInfo, VideoHolder> {
	
	public VideoAdapter(Context context) {
		super(context);
	}

	class VideoHolder extends BaseHolder {
		TextView title;
	}

	@Override
	public int onInflateView(int position) {
		return R.layout.layout_video;
	}

	@Override
	public VideoHolder onCreateHolder(View convertView, int position) {
		VideoHolder holder = new VideoHolder();
		holder.title = (TextView) convertView.findViewById(R.id.video_txt_title);
		return holder;
	}

	@Override
	public void onUpdate(VideoHolder holder, int position) {
		MediaInfo item = getItem(position);
		holder.title.setText(item.getName());
		holder.title.setSelected(item.equals(getSelect()));
	}
}

